const TYPE_DO = 15; // keywords: case, var, finally, else, do, try
const TYPE_FUNC = 16; // keywords: function
const TYPE_LITERAL = 17; // all literals, identifiers and unrecognised tokens
-
+
// Sanity limit to avoid excessive memory usage
const STACK_LIMIT = 1000;
self::TYPE_LITERAL => true
)
);
-
+
// Rules for when newlines should be inserted if
// $statementsOnOwnLine is enabled.
// $newlineBefore is checked before switching state,
return self::parseError($s, $end, 'Number with several E' );
}
$end++;
-
+
// + sign is optional; - sign is required.
$end += strspn( $s, '-+', $end );
$len = strspn( $s, '0123456789', $end );
$out .= ' ';
$lineLength++;
}
-
+
$out .= $token;
$lineLength += $end - $pos; // += strlen( $token )
$last = $s[$end - 1];
$pos = $end;
$newlineFound = false;
-
+
// Output a newline after the token if required
// This is checked before AND after switching state
$newlineAdded = false;
} elseif( isset( $goto[$state][$type] ) ) {
$state = $goto[$state][$type];
}
-
+
// Check for newline insertion again
if ( $statementsOnOwnLine && !$newlineAdded && isset( $newlineAfter[$state][$type] ) ) {
$out .= "\n";
}
return $out;
}
-
+
static function parseError($fullJavascript, $position, $errorMsg) {
// TODO: Handle the error: trigger_error, throw exception, return false...
return false;
'helptext' => $helptext,
);
}
-
+
function execute() {
if( $this->data['message'] ) {
?>
if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
foreach ( $this->data['extraInput'] as $inputItem ) { ?>
<tr>
- <?php
+ <?php
if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
- ?><td class="mw-label"><label for="<?php
+ ?><td class="mw-label"><label for="<?php
echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
$this->msgWiki( $inputItem['msg'] ) ?></label><?php
} else {
<input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
echo htmlspecialchars( $inputItem['name'] ); ?>"
tabindex="<?php echo $tabIndex++; ?>"
- value="<?php
+ value="<?php
if ( $inputItem['type'] != 'checkbox' ) {
echo htmlspecialchars( $inputItem['value'] );
} else {
echo '1';
- }
+ }
?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
- <?php
+ <?php
if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
- echo 'checked="checked"';
- ?> /> <?php
+ echo 'checked="checked"';
+ ?> /> <?php
if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
?>
<label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
<?php } ?>
</td>
</tr>
-<?php
-
+<?php
}
}
?>
importDump.php
XML dump importer
-
+
importImages.php
Import images into the wiki
-
+
importTextFile.php
Import the contents of a text file into a wiki page
moveBatch.php
- Move a batch of pages
+ Move a batch of pages
namespaceDupes.php
Check articles name to see if they conflict with new/existing namespaces
CSSJanus is CSS parser utility designed to aid the conversion of a website's
layout from left-to-right(LTR) to right-to-left(RTL). The script was born out of
-a need to convert CSS for RTL languages when tables are not being used for layout (since tables will automatically reorder TD's in RTL).
+a need to convert CSS for RTL languages when tables are not being used for layout (since tables will automatically reorder TD's in RTL).
CSSJanus will change most of the obvious CSS property names and their values as
-well as some not-so-obvious ones (cursor, background-position %, etc...).
-The script is designed to offer flexibility to account for cases when you do
+well as some not-so-obvious ones (cursor, background-position %, etc...).
+The script is designed to offer flexibility to account for cases when you do
not want to change certain rules which exist to account for bidirectional text
display bugs, as well as situations where you may or may not want to flip annotations inside of the background url string.
-Note that you can disable CSSJanus from running on an entire class or any
+Note that you can disable CSSJanus from running on an entire class or any
rule within a class by prepending a /* @noflip */ comment before the rule(s)
you want CSSJanus to ignore.
CSSJanus itself is not always enough to make a website that works in a LTR
-language context work in a RTL language all the way, but it is a start.
+language context work in a RTL language all the way, but it is a start.
==Getting the code==
{{{
$ svn checkout http://cssjanus.googlecode.com/svn/trunk/ cssjanus
-}}}
+}}}
==Using==
--swap_left_right_in_url: Fixes "left"/"right" string within urls.
Ex: ./cssjanus.py --swap_left_right_in_url < file.css > file_rtl.css
--swap_ltr_rtl_in_url: Fixes "ltr"/"rtl" string within urls.
- Ex: ./cssjanus.py --swap_ltr_rtl_in_url < file.css > file_rtl.css
-
+ Ex: ./cssjanus.py --swap_ltr_rtl_in_url < file.css > file_rtl.css
+
If you'd like to make use of the webapp version of cssjanus, you'll need to
download the Google App Engine SDK
http://code.google.com/appengine/downloads.html
and also drop a "django" directory into this directory, with the latest svn
-from django. You should be good to go with that setup. Please let me know
+from django. You should be good to go with that setup. Please let me know
otherwise.
==Bugs, Patches==
{{{
Copyright 2008 Google Inc. All Rights Reserved.
-
+
Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#!/usr/bin/hphpi -f
+#!/usr/bin/hphpi -f
<?php
define( 'MW_CONFIG_CALLBACK', 'MakeHipHop::noConfigNeeded' );
unlink( "$buildDir/source" );
}
- # With the CentOS RPMs, you just get g++44, no g++, so we have to
+ # With the CentOS RPMs, you just get g++44, no g++, so we have to
# use the environment
if ( isset( $_ENV['CXX'] ) ) {
$cxx = $_ENV['CXX'];
$cxx = 'g++';
}
- # Create a function that provides the HipHop compiler version, and
+ # Create a function that provides the HipHop compiler version, and
# doesn't exist when MediaWiki is invoked in interpreter mode.
$version = str_replace( PHP_EOL, ' ', trim( `hphp --version` ) );
file_put_contents(
$this->checkVolatileClasses( $outDir );
# Copy the generated C++ files into the source directory for cmake
- $iter = new RecursiveIteratorIterator(
+ $iter = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator( $outDir ),
RecursiveIteratorIterator::SELF_FIRST );
$sourceFiles = array();
}
# Do our own version of $HPHP_HOME/bin/run.sh, which isn't so broken.
- # HipHop's RELEASE mode seems to be stuck always on, so symbols get
- # stripped. Also we will try keeping the generated .o files instead of
+ # HipHop's RELEASE mode seems to be stuck always on, so symbols get
+ # stripped. Also we will try keeping the generated .o files instead of
# throwing away hours of CPU time every time you make a typo.
chdir( $persistentDir );
if ( $regenerateMakefile ) {
- copy( $_ENV['HPHP_HOME'] . '/bin/CMakeLists.base.txt',
+ copy( $_ENV['HPHP_HOME'] . '/bin/CMakeLists.base.txt',
"$persistentDir/CMakeLists.txt" );
if ( file_exists( "$persistentDir/CMakeCache.txt" ) ) {
$cmd = 'cmake' .
" -D CMAKE_BUILD_TYPE:string=" . wfEscapeShellArg( $GLOBALS['wgHipHopBuildType'] ) .
' -D PROGRAM_NAME:string=mediawiki-hphp';
-
+
if ( file_exists( '/usr/bin/ccache' ) ) {
$cmd .= ' -D CMAKE_CXX_COMPILER:string=ccache' .
' -D CMAKE_CXX_COMPILER_ARG1:string=' . wfEscapeShellArg( $cxx );
# Determine appropriate make concurrency
# Compilation can take a lot of memory, let's assume that that is limiting.
$procs = $this->getNumProcs();
-
+
# Run make. This is the slow step.
passthru( 'make -j' . wfEscapeShellArg( $procs ) );
$sourceBase = realpath( "$IP/.." );
}
- passthru(
+ passthru(
'cd ' . wfEscapeShellArg( $sourceBase ) . " && " .
'MW_INSTALL_PATH=' . wfEscapeShellArg( $IP ) . ' ' .
- wfEscapeShellArg(
+ wfEscapeShellArg(
"$buildDir/persistent/mediawiki-hphp",
'-c', "$thisDir/server.conf",
'-v', "Server.SourceRoot=$sourceBase",
cl_from BIGINT NOT NULL DEFAULT 0,
-- REFERENCES page(page_id) ON DELETE CASCADE,
cl_to VARCHAR(255) NOT NULL,
- -- cl_sortkey has to be at least 86 wide
+ -- cl_sortkey has to be at least 86 wide
-- in order to be compatible with the old MySQL schema from MW 1.10
--cl_sortkey VARCHAR(86),
cl_sortkey VARCHAR(230) FOR BIT DATA NOT NULL ,
CREATE TABLE user_properties (
-- Foreign key to user.user_id
up_user BIGINT NOT NULL,
-
+
-- Name of the option being saved. This is indexed for bulk lookup.
up_property VARCHAR(32) FOR BIT DATA NOT NULL,
-
+
-- Property value as a string.
up_value CLOB(64K) INLINE LENGTH 4096
);
-- This is read and executed by the install script; you should
-- not have to run it by itself unless doing a manual install.
--- Notes:
+-- Notes:
-- * DB2 will convert all table and column names to all caps internally.
-- * DB2 has a 32k limit on SQL filesize, so it may be necessary
-- to split this into two files soon.
-- REFERENCES page (page_id) ON DELETE CASCADE,
pp_propname VARCHAR(255) NOT NULL,
pp_value CLOB(64K) INLINE LENGTH 4096 NOT NULL,
- PRIMARY KEY (pp_page, pp_propname)
+ PRIMARY KEY (pp_page, pp_propname)
);
CREATE INDEX page_props_propname
ON page_props (pp_propname);
pl_namespace SMALLINT NOT NULL,
pl_title VARCHAR(255) NOT NULL
);
-CREATE UNIQUE INDEX pagelink_unique
+CREATE UNIQUE INDEX pagelink_unique
ON pagelinks (pl_from, pl_namespace, pl_title);
cl_from BIGINT NOT NULL DEFAULT 0,
-- REFERENCES page(page_id) ON DELETE CASCADE,
cl_to VARCHAR(255) NOT NULL,
- -- cl_sortkey has to be at least 86 wide
+ -- cl_sortkey has to be at least 86 wide
-- in order to be compatible with the old MySQL schema from MW 1.10
--cl_sortkey VARCHAR(86),
cl_sortkey VARCHAR(230) FOR BIT DATA NOT NULL,
);
CREATE INDEX ipb_address
ON ipblocks (ipb_address);
-CREATE INDEX ipb_user
+CREATE INDEX ipb_user
ON ipblocks (ipb_user);
CREATE INDEX ipb_range
ON ipblocks (ipb_range_start, ipb_range_end);
rc_log_type VARCHAR(255),
rc_log_action VARCHAR(255),
rc_params CLOB(64K) INLINE LENGTH 4096
-
);
CREATE INDEX rc_timestamp
ON recentchanges (rc_timestamp);
--
--- Store information about newly uploaded files before they're
+-- Store information about newly uploaded files before they're
-- moved into the actual filestore
--
CREATE TABLE uploadstash (
--- Stores the groups the user has once belonged to.
+-- Stores the groups the user has once belonged to.
-- The user may still belong these groups. Check user_groups.
CREATE TABLE user_former_groups (
ufg_user BIGINT NOT NULL DEFAULT 0,
CREATE INDEX /*$wgDBprefix*/user_group_id ON /*$wgDBprefix*/user_newtalk([user_id]);
CREATE INDEX /*$wgDBprefix*/user_ip ON /*$wgDBprefix*/user_newtalk(user_ip);
---
+--
-- User preferences and other fun stuff
-- replaces old user.user_options BLOB
---
+--
CREATE TABLE /*$wgDBprefix*/user_properties (
up_user INT NOT NULL,
up_property NVARCHAR(32) NOT NULL,
-- The fields generally correspond to the page, revision, and text
-- fields, with several caveats.
-- Cannot reasonably create views on this table, due to the presence of TEXT
--- columns.
+-- columns.
CREATE TABLE /*$wgDBprefix*/archive (
ar_namespace SMALLINT NOT NULL DEFAULT 0,
ar_title NVARCHAR(255) NOT NULL DEFAULT '',
CREATE INDEX /*$wgDBprefix*/cl_timestamp ON /*$wgDBprefix*/categorylinks(cl_to,cl_timestamp);
--;
---
+--
-- Track all existing categories. Something is a category if 1) it has an en-
-- try somewhere in categorylinks, or 2) it once did. Categories might not
-- have corresponding pages, so they need to be tracked separately.
vt_tag varchar(255) NOT NULL PRIMARY KEY
);
---
+--
-- Table for storing localisation data
---
+--
CREATE TABLE /*$wgDBprefix*/l10n_cache (
-- language code
lc_lang NVARCHAR(32) NOT NULL,
-
+
-- cache key
lc_key NVARCHAR(255) NOT NULL,
-
+
-- Value
lc_value TEXT NOT NULL DEFAULT '',
);
-- Maximum key length ON SQL Server is 900 bytes
CREATE INDEX /*$wgDBprefix*/externallinks_index ON /*$wgDBprefix*/externallinks(el_index);
---
+--
-- Track external user accounts, if ExternalAuth is used
---
+--
CREATE TABLE /*$wgDBprefix*/external_user (
-- Foreign key to user_id
eu_local_id INT NOT NULL PRIMARY KEY,
);
CREATE UNIQUE INDEX /*$wgDBprefix*/langlinks_reverse_key ON /*$wgDBprefix*/langlinks(ll_lang,ll_title);
---
+--
-- Track inline interwiki links
---
+--
CREATE TABLE /*$wgDBprefix*/iwlinks (
-- page_id of the referring page
iwl_from INT NOT NULL DEFAULT 0,
-
+
-- Interwiki prefix code of the target
iwl_prefix NVARCHAR(20) NOT NULL DEFAULT '',
-
+
-- Title of the target, including namespace
iwl_title NVARCHAR(255) NOT NULL DEFAULT '',
);
PRIMARY KEY (ul_key)
);
--- NOTE To enable full text indexing on SQL 2008 you need to create an account FDH$MSSQLSERVER
+-- NOTE To enable full text indexing on SQL 2008 you need to create an account FDH$MSSQLSERVER
-- AND assign a password for the FDHOST process to run under
-- Once you have assigned a password to that account, you need to run the following stored procedure
-- replacing XXXXX with the password you used.
ON &mw_prefix.testrun
BEGIN
SELECT testrun_tr_id_seq.NEXTVAL into :NEW.tr_id FROM dual;
-END;
+END;
CREATE TABLE /*$wgDBprefix*/testitem (
ti_run NUMBER NOT NULL REFERENCES &mw_prefix.testrun (tr_id) ON DELETE CASCADE,
ti_run INTEGER NOT NULL REFERENCES testrun(tr_id) ON DELETE CASCADE,
ti_name TEXT NOT NULL,
ti_success SMALLINT NOT NULL
-);
+);
CREATE UNIQUE INDEX testitem_uniq ON testitem(ti_run, ti_name);
---
+--
-- Recreates the iwl_prefix for the iwlinks table
--
DROP INDEX IF EXISTS /*i*/iwl_prefix;
-- Patch that introduces fulltext search capabilities to SQLite schema
-- Requires that SQLite must be compiled with FTS3 module (comes with core amalgamation).
-- See http://sqlite.org/fts3.html for details of syntax.
--- Will fail if FTS3 is not present,
+-- Will fail if FTS3 is not present,
DROP TABLE IF EXISTS /*_*/searchindex;
CREATE VIRTUAL TABLE /*_*/searchindex USING FTS3(
-- Key to page_id
-- Munged version of title
si_title,
-
+
-- Munged version of body text
si_text
);
-- Munged version of title
si_title TEXT,
-
+
-- Munged version of body text
si_text TEXT
);
fi
if [ -z $3 ]; then
table=blobs
-else
+else
table=$3
fi
echo "CREATE DATABASE $2" | mysql -u wikiadmin -p`wikiadmin_pass` -h $1 && \
sed "s/blobs\>/$table/" blobs.sql | mysql -u wikiadmin -p`wikiadmin_pass` -h $1 $2
-
-
$out->addModuleStyles( 'mediawiki.legacy.oldshared' );
$out->addModuleStyles( 'skins.cologneblue' );
}
-
+
/**
* Override langlink formatting behavior not to uppercase the language names.
* See otherLanguages() in CologneBlueTemplate.
$this->printTrail();
echo "\n</body></html>";
}
-
/**
* Language/charset variant links for classic-style skins
return $this->getSkin()->getLanguage()->pipeList( $s );
}
-
+
// @fixed
function otherLanguages() {
global $wgHideInterlanguageLinks;
function pageTitleLinks() {
$s = array();
$footlinks = $this->getFooterLinks();
-
+
foreach ( $footlinks['places'] as $item ) {
$s[] = $this->data[$item];
}
-
+
return $this->getSkin()->getLanguage()->pipeList( $s );
}
return $s;
}
-
+
/**
* @return string
- *
+ *
* @fixed
*/
function beforeContent() {
</a>
</p>
<p id="sitesub"><?php echo wfMessage( 'sitesubtitle' )->escaped() ?></p>
-
<div id="toplinks">
<p id="syslinks"><?php echo $this->sysLinks() ?></p>
<p id="variantlinks"><?php echo $this->variantLinks() ?></p>
<?php
$s = ob_get_contents();
ob_end_clean();
-
+
return $s;
}
/**
* @return string
- *
+ *
* @fixed
*/
function afterContent() {
// Page-related links
echo $this->bottomLinks();
echo "\n<br />";
-
+
// Footer and second searchbox
echo $this->getSkin()->getLanguage()->pipeList( array(
$this->getSkin()->mainPageLink(),
$this->searchForm( 'footer' )
) );
echo "\n<br />";
-
+
// Standard footer info
$footlinks = $this->getFooterLinks();
if ( $footlinks['info'] ) {
/**
* @return string
- *
+ *
* @fixed
*/
function sysLinks() {
return $this->getSkin()->getLanguage()->pipeList( $s );
}
-
-
-
/**
* @param $heading string
* @return string
- *
+ *
* @fixed
*/
function menuHead( $heading ) {
* @access private
*
* @return string
- *
+ *
* @fixed
*/
function quickBar(){
$s = "\n<div id='quickbar'>";
$sep = "<br />\n";
-
+
$plain_bar = $this->data['sidebar'];
$bar = array();
-
+
// Massage the sidebar
// We want to place SEARCH at the beginning and a lot of stuff before TOOLBOX (or at the end, if it's missing)
$additions_done = false;
while ( !$additions_done ) {
$bar = array(); // Empty it out
-
+
// Always display search on top
$bar['SEARCH'] = true;
-
+
foreach ( $plain_bar as $heading => $links ) {
if ( $heading == 'TOOLBOX' ) {
if( $links !== NULL ) {
// If this is not a toolbox prosthetic we inserted outselves, fill it out
$plain_bar['TOOLBOX'] = $this->getToolbox();
}
-
+
// And insert the stuff
-
+
// "This page" and "Edit" menus
// We need to do some massaging here... we reuse all of the items, except for $...['views']['view'],
// as $...['namespaces']['main'] and $...['namespaces']['talk'] together serve the same purpose.
);
$bar['qbedit'] = $qbedit;
$bar['qbpageoptions'] = $qbpageoptions;
-
+
// Personal tools ("My pages")
$bar['qbmyoptions'] = $this->getPersonalTools();
foreach ( array ( 'logout', 'createaccount', 'login', 'anonlogin' ) as $key ) {
$bar['qbmyoptions'][$key] = false;
}
-
+
$additions_done = true;
}
-
+
// Re-insert current heading, unless it's SEARCH
if ( $heading != 'SEARCH' ) {
$bar[$heading] = $plain_bar[$heading];
}
}
-
+
// If TOOLBOX is missing, $additions_done is still false
if ( !$additions_done ) {
$plain_bar['TOOLBOX'] = false;
}
}
-
+
foreach ( $bar as $heading => $links ) {
if ( $heading == 'SEARCH' ) {
$s .= $this->menuHead( wfMessage( 'qbfind' )->text() );
if ( $heading == 'TOOLBOX' ) {
$heading = 'toolbox';
}
-
+
$headingMsg = wfMessage( $heading );
$any_link = false;
$t = $this->menuHead( $headingMsg->exists() ? $headingMsg->text() : $heading );
-
+
foreach ( $links as $key => $link ) {
// Can be empty due to rampant sidebar massaging we're doing above
if ( $link ) {
$t .= $this->makeListItem( $key, $link, array( 'tag' => 'span' ) ) . $sep;
}
}
-
+
if ( $any_link ) {
$s .= $t;
}
/**
* @param $label string
* @return string
- *
+ *
* @fixed
*/
function searchForm( $which ) {
/**
* Adds classes to the body element.
- *
+ *
* @param $out OutputPage object
* @param &$bodyAttrs Array of attributes that will be set on the body element
*/